package com.typing.alarm.value;

import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

public class TypingAlarmVO implements Parcelable{
	private String alarmId;
	private String alarmName;
	private String alarmTime;
	private String repeatYn;
	private String repeatInterval;
	private String ringType;
	private String ringSound;	
	private boolean repeatDay[] = new boolean[7];
	private String typingText;
	private String typingSpeed;
	private String useYn;
	public TypingAlarmVO() {        
    }
	public boolean[] getRepeatDay() {
		return repeatDay;
	}
	public void setRepeatDay(boolean[] repeatDay) {
		this.repeatDay = repeatDay;
	}
	public void setRepeatDayByString(String str){
		
    	String[] tempStr = str.split(",");
    	boolean[] result = new boolean[tempStr.length];
    	for(int i=0 ; i < tempStr.length ; i++){
    		if("true".equals(tempStr[i])){
    			result[i] = true;
    		}else{
    			result[i] = false;
    		}
    		
    	}
    	repeatDay = result;
    }
    public String getRepeatDayToString(){
    	String tempStr = "";
    	for(int i=0 ; i < repeatDay.length ; i++){
    		if(i != 0){
    			tempStr += ",";
    		}
    		if(repeatDay[i]){
    			tempStr += "true";
    		}else{
    			tempStr += "false";
    		}
    		
    	}
    	return tempStr;
    }
	public String getAlarmId() {
		return alarmId;
	}
	public void setAlarmId(String alarmId) {
		this.alarmId = alarmId;
	}
	public String getAlarmName() {
		return alarmName;
	}
	public void setAlarmName(String alarmName) {
		this.alarmName = alarmName;
	}
	public String getAlarmTime() {
		return alarmTime;
	}
	public void setAlarmTime(String alarmTime) {
		this.alarmTime = alarmTime;
	}
	public String getRepeatYn() {
		return repeatYn;
	}
	public void setRepeatYn(String repeatYn) {
		this.repeatYn = repeatYn;
	}
	public String getRepeatInterval() {
		return repeatInterval;
	}
	public void setRepeatInterval(String repeatInterval) {
		this.repeatInterval = repeatInterval;
	}
	public String getRingType() {
		return ringType;
	}
	public void setRingType(String ringType) {
		this.ringType = ringType;
	}
	public String getRingSound() {
		return ringSound;
	}
	public void setRingSound(String ringSound) {
		this.ringSound = ringSound;
	}	
	public String getTypingText() {
		return typingText;
	}
	public void setTypingText(String typingText) {
		this.typingText = typingText;
	}
	public String getTypingSpeed() {
		return typingSpeed;
	}
	public void setTypingSpeed(String typingSpeed) {
		this.typingSpeed = typingSpeed;
	}
	public String getUseYn() {
		return useYn;
	}
	public void setUseYn(String useYn) {
		this.useYn = useYn;
	}
	public TypingAlarmVO(Parcel src) {
    	//Log.d("", "products_name :: read===>>"+products_name);
    	this.alarmId = src.readString();
        this.alarmName = src.readString();
        this.alarmTime = src.readString();
        this.repeatYn = src.readString();
        this.repeatInterval = src.readString();
        this.ringType = src.readString();
        this.ringSound = src.readString();
        src.readBooleanArray(this.repeatDay);
        this.typingText = src.readString();
        this.typingSpeed = src.readString();
        this.useYn = src.readString();
        
    }
	public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
        public TypingAlarmVO createFromParcel(Parcel in) {
            return new TypingAlarmVO(in);
        }

        public TypingAlarmVO[] newArray(int size) {
            return new TypingAlarmVO[size];
        }
    };
	@Override
	public int describeContents() {
		return 0;
	}
	@Override
	public void writeToParcel(Parcel dest, int arg1) {
		//Log.d("", "products_name :: write===>>"+products_name);
        dest.writeString(this.alarmId);
        dest.writeString(this.alarmName);
        dest.writeString(this.alarmTime);
        dest.writeString(this.repeatYn);
        dest.writeString(this.repeatInterval);
        dest.writeString(this.ringType);
        dest.writeString(this.ringSound);
        dest.writeBooleanArray(this.repeatDay);
        dest.writeString(this.typingText);
        dest.writeString(this.typingSpeed);
        dest.writeString(this.useYn);
	}
}
